package com.sky.loveshop.entity.meiTuan;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author xcy
 * @version V1.0
 * @description 拉取配送日志响应
 * 外送帮 https://www.waisongbang.com/apiDoc/#/order/list?v=1.2.4
 * @date 2024/9/2 23:21
 */
@NoArgsConstructor
@Data
public class MtOrderPullDeliverRecordsResponse {

    @JsonProperty("code")
    private Integer code;
    @JsonProperty("msg")
    private String msg;
    @JsonProperty("data")
    private List<DataDTO> data;

    @NoArgsConstructor
    @Data
    public static class DataDTO {
        @JsonProperty("delivery_uuid")
        private String deliveryUuid;
        @JsonProperty("store_id")
        private Integer storeId;
        @JsonProperty("out_id")
        private String outId;
        @JsonProperty("driver_name")
        private String driverName;
        @JsonProperty("driver_phone")
        private String driverPhone;
        @JsonProperty("distance")
        private Integer distance;
        @JsonProperty("fee")
        private Float fee;
        @JsonProperty("deduct_fee")
        private Integer deductFee;
        /**
         * 运单状态：待接单＝1,待取货＝2,配送中＝3,已完成＝4,已取消＝5(这个是文档上来的，压根跟实际对不上，以下方注释为准)
         * 运单状态：创建=0,已接单=1,已取货=2,在途=3,完成=4,已取消=5
         */
        @JsonProperty("state")
        private Integer state;
        @JsonProperty("weight")
        private Integer weight;
        @JsonProperty("created")
        private String created;
        @JsonProperty("way_code")
        private Integer wayCode;
        @JsonProperty("way_name")
        private String wayName;
        @JsonProperty("state_label")
        private String stateLabel;
        @JsonProperty("timeline")
        private List<TimelineDTO> timeline;

        @NoArgsConstructor
        @Data
        public static class TimelineDTO {
            @JsonProperty("delivery_id")
            private Integer deliveryId;
            @JsonProperty("driver_name")
            private String driverName;
            @JsonProperty("driver_phone")
            private String driverPhone;
            @JsonProperty("remark")
            private String remark;
            /**
             * 运单状态：待接单＝1,待取货＝2,配送中＝3,已完成＝4,已取消＝5(这个是文档上来的，压根跟实际对不上，以下方注释为准)
             * 运单状态：创建=0,已接单=1,已取货=2,在途=3,完成=4,已取消=5
             */
            @JsonProperty("state")
            private Integer state;
            @JsonProperty("created")
            private String created;
            @JsonProperty("state_name")
            private String stateName;
        }
    }

    public Boolean isSuccess() {
        return code == 0;
    }
}
